package wifiunion.com.notice.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;


import java.util.ArrayList;

import wifiunion.com.notice.fragment.CoverConfigueFragment;
import wifiunion.com.notice.fragment.NoticeBackgroundFragment;
import wifiunion.com.notice.fragment.NoticeConfigueFragment;

/**
 * Created by Administrator on 2017/6/9.
 */

public class ConfigueAdapter extends FragmentStatePagerAdapter {


    private ArrayList<String> mFragmentTitleList = new ArrayList<>();


    private Context mContext;

    public ConfigueAdapter(Context context, FragmentManager fm, ArrayList<String> datalist) {
        super(fm);
        mContext = context;
        mFragmentTitleList = datalist;
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        String title = mFragmentTitleList.get(position);

        /*if ("place".equals(title)) {
            fragment = new PlaceConfigueFragment();
        } else*/ if ("cover".equals(title)) {
            fragment = new CoverConfigueFragment();
        } else if ("notice".equals(title)) {
            fragment = new NoticeConfigueFragment();
        } else if ("tzbg".equals(title)) {
            fragment = new NoticeBackgroundFragment();
        } /*else if ("stranger".equals(title)) {
            fragment = new StrangerClearConfigueFragment();
        } else if ("fzpz".equals(title)) {
            fragment = FacerecoConfigueFragment.newInstance();
        } else if ("xxtx".equals(title)) {
            fragment = new MessageConfigueFragment();
        } else if ("ccgl".equals(title)) {
            fragment = new StoragemanageFragment();
        }*/


        return fragment;
    }

    @Override
    public int getCount() {
        return mFragmentTitleList.size();
    }


    @Override
    public CharSequence getPageTitle(int position) {
        String title = mFragmentTitleList.get(position);
        if ("place".equals(title)) {
            title = "场所配置";
        } else if ("cover".equals(title)) {
            title = "首屏配置";
        } else if ("notice".equals(title)) {
            title = "通知配置";
        } else if ("lfgl".equals(title)) {
            title = "来访管理";
        } else if ("stranger".equals(title)) {
            title = "未登记人员管理";
        } else if ("fzpz".equals(title)) {
            title = "人脸识别";
        } else if ("xxtx".equals(title)) {
            title = "消息提醒";
        } else if ("ccgl".equals(title)) {
            title = "存储管理";
        }else if ("tzbg".equals(title)) {
            title = "通知背景";
        }
        return (CharSequence) title;
    }


}
